#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta


def datestrFormat(dt: str):
    dt_arr = [int(item) for item in dt.split('.')]
    this_year = datetime.now().year
    dt = datetime(this_year, *dt_arr)
    # 获取当前日期
    current_date = datetime.now()
    # 计算日期差异
    date_diff = current_date - dt
    # print(date_diff)
    # 如果相差超过6个月（约180天），则将字符日期加一年
    if date_diff > timedelta(days=180):
        # print("overhaul")
        dt = dt.replace(year=dt.year + 1)

    flightDate = dt.strftime("%Y-%m-%d")
    return flightDate


print(datestrFormat('07.28'))

import random

def split_random_number(total, n):
    if total < 2:
        return [0 for _ in range(n)]
    # 生成n-1个随机数并排序
    random_points = sorted([random.randint(1, total - 1) for _ in range(n - 1)])
    # 计算每一份的值
    parts = [random_points[0]] + [random_points[i]-random_points[i-1] for i in range(1,len(random_points))] + [total-random_points[-1]]
    return parts


# 示例：将100随机分成4份
total = 1
n = 10
result = split_random_number(total, n)
print(result)
